/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"D7B26709-FF2E-4A4C-B1A1-B7EA21FB266C"}
 */
function confirmar(event) {
	if (hospital_id == null || cod_interno == null || id_envio == null)
	{
		globals.DIALOGS.showWarningDialog('Error','Falta ingresar datos para poder confirmar','OK')
		return;
	} 
	
	databaseManager.startTransaction() 
	var estado_save = databaseManager.saveData();
	if (estado_save == true)
	{
		databaseManager.commitTransaction()
		globals.DIALOGS.showInfoDialog('Carga de Destino',  'Destino Nro. ' + muestra_destino_id + ' ingresado correctamente',  "OK")
		var $win = application.getWindow('DESTINOS_CARGA')
		$win.hide()
		$win.destroy()
	}
	else
	{
		databaseManager.rollbackTransaction();
		globals.DIALOGS.showInfoDialog('Carga de Destino',  'Error al grabar destino',  "OK")
	}
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"CF18F9E2-D1F4-454B-9A31-C458D9CA2F1B"}
 */
function cancelar(event) {
	databaseManager.revertEditedRecords();
	var $win = application.getWindow('DESTINOS_CARGA')
	$win.hide()
	$win.destroy()
}
